<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.candy.bean.Student" %>
<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2023/3/31
  Time: 14:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>标签库的应用</title>
</head>
<body>
<%
session.setAttribute("username","tom");
    List lsuser=new ArrayList();
    lsuser.add(new Student(100,"张三"));
    lsuser.add(new Student(101,"李四"));
    lsuser.add(new Student(102,"王五"));
    lsuser.add(new Student(103,"赵六"));

session.setAttribute("students",lsuser);

%>
<%--核心标签可以if标签的用法--%>
<c:if test="${not empty sessionScope.username}">
    ${username}
</c:if>

<c:choose>
    <c:when test="${not empty sessionScope.username}">
        欢迎您：${sessionScope.username }
    </c:when>
    <c:otherwise>
        欢迎您：游客
    </c:otherwise>
</c:choose>

<c:forEach items="${sessionScope.students}" var="student" varStatus="status">
    序号：${status.index}
    学号：${student["stu_no"]}
    姓名：${student["stu_name"]}
</c:forEach>
<br/>
当前时间：<fmt:formatDate value="<%=new Date()%>"/>





</body>
</html>
